package com.yangcsoft.modules.deptmanage.service.impl;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.Map;
import com.baomidou.mybatisplus.mapper.EntityWrapper;
import com.baomidou.mybatisplus.plugins.Page;
import com.baomidou.mybatisplus.service.impl.ServiceImpl;
import com.yangcsoft.common.utils.PageUtils;
import com.yangcsoft.common.utils.Query;

import com.yangcsoft.modules.deptmanage.dao.StaffInfoDao;
import com.yangcsoft.modules.deptmanage.entity.StaffInfoEntity;
import com.yangcsoft.modules.deptmanage.service.StaffInfoService;


@Service("staffInfoService")
public class StaffInfoServiceImpl extends ServiceImpl<StaffInfoDao, StaffInfoEntity> implements StaffInfoService {
    @Autowired
    private StaffInfoDao dao;
    @Override
    public PageUtils queryPage(Map<String, Object> params) {
        String key = params.get("key").toString();
        Page<StaffInfoEntity> page = this.selectPage(
                new Query<StaffInfoEntity>(params).getPage(),
                new EntityWrapper<StaffInfoEntity>()
                                             .like("userseq",key)
                 .or()
                                                             .like("username",key)
                 .or()
                                                             .like("gender",key)
                 .or()
                                                             .like("birthday",key)
                 .or()
                                                             .like("id_type",key)
                 .or()
                                                             .like("id_no",key)
                 .or()
                                                             .like("marriage",key)
                 .or()
                                                             .like("nation",key)
                 .or()
                                                             .like("native_place",key)
                 .or()
                                                             .like("birth_place",key)
                 .or()
                                                             .like("join_party_date",key)
                 .or()
                                                             .like("normal_party_date",key)
                 .or()
                                                             .like("test_salary",key)
                 .or()
                                                             .like("normal_salary",key)
                 .or()
                                                             .like("social_insurance_status",key)
                 .or()
                                                             .like("accumulation_fund",key)
                 .or()
                                                             .like("participation_date",key)
                 .or()
                                                             .like("healthy",key)
                 .or()
                                                             .like("academic_degree",key)
                 .or()
                                                             .like("education_level",key)
                 .or()
                                                             .like("political",key)
                 .or()
                                                             .like("job_level",key)
                 .or()
                                                             .like("userstatus",key)
                 .or()
                                                             .like("emergency_contact",key)
                 .or()
                                                             .like("emergency_contact_tel",key)
                 .or()
                                                             .like("create_date",key)
                 .or()
                                                             .like("create_user",key)
                 .or()
                                                             .like("update_time",key)
                 .or()
                                                            .like("update_user",key)
                                    );

        return new PageUtils(page);
    }

    @Override
    public void save(StaffInfoEntity entity) {
        dao.save(entity);
    }


}
